<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://unpkg.com/react@18/umd/react.development.js"></script>
  <script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>

  <!-- Don't use this in production: -->
  <script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
</head>

<body>
  <div id="root"></div>
  <div id="app"></div>
  <script type="text/babel">
    let message = 'Hello, World!'

    function handleClick() {
      message = 'Hello, React!'
      console.log('clicked')
      root.render((
        <div>
          <h2>{message}</h2>
          <button onClick={handleClick}>修改文本</button>
        </div>
      ))
    }
 
    const root = ReactDOM.createRoot(document.getElementById('root'))
    root.render((
      <div>
        <h2>{message}</h2>
        <button onClick={handleClick}>修改文本</button>
      </div>
    ))



  </script>
</body>

</html>